package com.rzjm.exercise.module.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rzjm.exercise.common.base.data.DataTableLayUI;
import com.rzjm.exercise.common.base.service.impl.BaseServiceImpl;
import com.rzjm.exercise.module.dao.PickUpPlanDao;
import com.rzjm.exercise.module.domain.PickUpPlan;
import com.rzjm.exercise.module.service.PickUpPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class PickUpPlanServiceImpl extends BaseServiceImpl<PickUpPlanDao, PickUpPlan> implements PickUpPlanService {
    @Resource
    private PickUpPlanDao pickUpPlanDao;

    @Override
    public DataTableLayUI<PickUpPlan> getListPage(DataTableLayUI<PickUpPlan> condition) {
        Page<PickUpPlan> page = new Page<>(condition.getPage(), condition.getLimit());
        List<PickUpPlan> list = pickUpPlanDao.getListPage(page, condition.getSearchParams());
        condition.setCount(page.getTotal());
        condition.setData(list);
        condition.setTotalPages(page.getPages());
        condition.setCode(0);
        condition.setMsg("success");
        return condition;
    }
}
